<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>新增歌单</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../static/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=20200727" rel="stylesheet"/>
    <link href="../static/css/animate.css" rel="stylesheet"/>
    <link href="../static/css/style.css?v=20200903" rel="stylesheet"/>
    <link href="../static/ruoyi/css/ry-ui.css?v=4.4.0" rel="stylesheet"/>
    <!-- bootstrap-select 下拉框插件-->
    <link href="../static/ajax/libs/bootstrap-select/bootstrap-select.min.css" rel="stylesheet"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-playlist-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">创建用户：</label>
            <div class="col-sm-8">
                <select name="userId" class="form-control m-b">
                    <option value="1">网易云音乐</option>
                    <option value="2">不猜猜</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">歌单ID：</label>
            <div class="col-sm-8">
                <input name="id" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">歌单名：</label>
            <div class="col-sm-8">
                <input name="name" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">歌单描述：</label>
            <div class="col-sm-8">
                <input name="description" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">歌单图片：</label>
            <div class="col-sm-8">
                <input name="coverImgUrl" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">标签类型：</label>
            <div class="col-sm-8">
                <select id="tag-id" class="form-control selectpicker" data-live-search="true" multiple
                        data-max-options="3">
                    <optgroup label="语种" id="tag-type-language">
                    </optgroup>
                    <optgroup label="风格" id="tag-type-style">
                    </optgroup>
                    <optgroup label="场景" id="tag-type-scene">
                    </optgroup>
                    <optgroup label="情感" id="tag-type-feeling">
                    </optgroup>
                    <optgroup label="主题" id="tag-type-theme">
                    </optgroup>
                </select>
                <input type="hidden" id="input-tag-id" name="tagStr">
            </div>
        </div>
    </form>
</div>
<a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="../static/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727"></script>
<script src="../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727"></script>
<script src="../static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727"></script>
<!-- bootstrap-select 下拉框插件-->
<script src="../static/ajax/libs/bootstrap-select/bootstrap-select.min.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="../static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="../static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="../static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="../static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- 遮罩层 -->
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="../static/ajax/libs/iCheck/icheck.min.js"></script>
<script src="../static/ajax/libs/layer/layer.min.js"></script>
<script src="../static/ajax/libs/layui/layui.js"></script>
<script src="../static/ruoyi/js/common.js?v=4.4.0"></script>
<script src="../static/ruoyi/js/ry-ui.js?v=4.4.0"></script>

<script type="text/javascript">
    let ctx = storage.get('ctx');
    let prefix = ctx + "playlist";
    let tagUrl = ctx + "tag";
    $(function () {
        $.operate.get(tagUrl + "/selectAll.do", function (e) {
            console.log(e);
            var language = "";
            var style = "";
            var scene = "";
            var feeling = "";
            var theme = "";
            console.log(e.data[0].name);
            $.each(e.data, function (index, val) {
                if (val.category == "1") {
                    language += "<option value=" + val.id + ">" + val.name + "</option>";
                } else if (val.category == "2") {
                    style += "<option value=" + val.id + ">" + val.name + "</option>"
                } else if (val.category == "3") {
                    scene += "<option value=" + val.id + ">" + val.name + "</option>"
                } else if (val.category == "4") {
                    feeling += "<option value=" + val.id + ">" + val.name + "</option>"
                } else {
                    theme += "<option value=" + val.id + ">" + val.name + "</option>"
                }
            });
            $("#tag-type-language").append(language);
            $("#tag-type-style").append(style);
            $("#tag-type-scene").append(scene);
            $("#tag-type-feeling").append(feeling);
            $("#tag-type-theme").append(theme);
        });
        // 将下拉多选框中选中的值通过input输入框传入后台
        $('#tag-id').on('changed.bs.select', function (e) {
            $('#input-tag-id').val($(this).val());
        });
    });


    $("#form-playlist-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/insert.do", $('#form-playlist-add').serialize());
        }
    }
</script>
</body>
</html>